﻿using MediatR;
using T.Vehicleservice.API.Application.Command.TireUsageRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.TireUsageRecordHandler
{
    public class TireUsageRecordUpdateCommandHandler : IRequestHandler<TireUsageRecordUpdateCommand, int>
    {
        private readonly ITireUsageRecordRepository _repository;
        public TireUsageRecordUpdateCommandHandler(ITireUsageRecordRepository repository)
        {
            _repository = repository;
        }

        public async Task<int> Handle(TireUsageRecordUpdateCommand request, CancellationToken cancellationToken)
        {
            return await _repository.UpdateAsync(request);
        }
    }
}
